package com.jinlong.dao;

import com.jinlong.common.mybatis.BaseDao;
import com.jinlong.entity.UserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.sql.Timestamp;

@Mapper
public interface UserDao extends BaseDao{

    @Select("select id,user_name,pass_word,phone,email,created_time,update_time from mb_user" +
            " where phone = #{phone} and pass_word = #{passWord}")
    public UserEntity getUerPhoneAndPwd(@Param("phone") String phone,@Param("passWord")String passWord);

    @Select("select user_name,pass_word,phone,email,created_time,update_time from mb_user" +
            " where id = #{id} ")
    public UserEntity getUserInfo(@Param("id") Long id);

    @Select("select id,user_name,pass_word,phone,email, created_time,update_time from mb_user  WHERE openid=#{openid}")
    public UserEntity findOpenId(@Param("openid") String openid);

    @Select("update mb_user set openid = #{openid},update_time=#{update_time} where id=#{id}")
    public void UpdateUserOpenid(@Param("openid") String openid,@Param("update_time") Timestamp update_time,@Param("id")Long id);

}
